package com.sm.service;

import com.github.pagehelper.PageHelper;
import com.sm.bo.SolveCommentBo;
import com.sm.dao.SolveCommentMapper;
import com.sm.model.SolveComment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.swing.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class SolveCommentService {

    @Autowired
    private SolveCommentMapper mapper;

    /**
     * 根据问题的id拉取该回答所有的评论和回复
     * @param requestId
     * @return
     */
    public List<SolveComment> selectSolveComment(Integer requestId,Integer currentPage,Integer pageSize){
        PageHelper.startPage(currentPage,pageSize);
        return mapper.select(requestId);
    }


    /**
     * 对幸福问答的回答进行评论
     */
    public int insertSolveComment(SolveComment solveComment){
        int i = mapper.insertSolveComment(solveComment);
        return i;
    }

    /**
     * 根据评论id查询这一条评论
     */
    public SolveComment selectOne(Integer id){
        return mapper.selectOne(id);
    }



}
